home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / By the Book / Mac C Primer V2 / 3.1 - AFI / AFI.c < prev    next >
C/C++ Source or Header  |  1990-09-04  |  1KB  |  59 lines

  1. /************************************************************/
  2. /*                                                            */
  3. /*    AFI Code from Chapter Three of                            */
  4. /*                                                            */
  5. /*        *** The Macintosh Programming Primer ***            */
  6. /*                                                            */
  7. /*    Copyright 1990, Dave Mark                                */
  8. /*                                                            */
  9. /*    This program demonstrates specific Mac programming        */
  10. /*    techniques.                                                */
  11. /*                                                            */
  12. /************************************************************/
  13.  
  14. #define BASE_ICON_ID    128
  15. #define LAST_ICON_ID    -4064
  16. #define PROC_ID            128
  17. #define WORD_RES_ID        -4048
  18. #define NUM_ICONS        8
  19. #define NORMAL_APP_FONT    applFont
  20. #define DELAY            30L
  21.  
  22. main()
  23. {
  24.     Handle    procH, wHandle;
  25.     int        i, fontNumber;
  26.     long    dummy;
  27.     
  28.       if ( ( wHandle = GetResource( 'word', WORD_RES_ID ) ) != 0L )
  29.       {
  30.           fontNumber = *( (short *)(*wHandle) );
  31.           
  32.           *( (short *) 0x0204 ) = fontNumber - 1;
  33.           
  34.           WriteParam();
  35.       
  36.           if ( ( procH = GetResource( 'PROC', PROC_ID ) ) != 0L )
  37.           {
  38.             HLock(procH);
  39.             
  40.             if ( fontNumber == NORMAL_APP_FONT )
  41.             {
  42.                 CallPascal( BASE_ICON_ID + NUM_ICONS, -1, *procH);
  43.             }
  44.             else
  45.             {
  46.                 CallPascal( BASE_ICON_ID, 0, *procH);
  47.                 
  48.                 Delay( DELAY, &dummy );
  49.                     
  50.                 for ( i=1; i<NUM_ICONS-1; i++ )
  51.                     CallPascal( BASE_ICON_ID + i, 0, *procH);
  52.                 
  53.                 CallPascal( LAST_ICON_ID, -1, *procH);
  54.             }
  55.             
  56.             HUnlock(procH);
  57.         }
  58.     }
  59. }